"""
@-*- coding: utf-8 -*-
@ python: 3.12.3
@ 创建者: JacksonCode
@ 创建时间: 2025/8/30
"""

import subprocess
from functools import partial

subprocess.Popen = partial(subprocess.Popen, encoding="utf-8")

import requests
import time
import execjs

js_code = open("fengniao.js").read()
js_compile = execjs.compile(js_code)

now = str(int(time.time() * 1000))
headers = {
    "accept": "application/json, text/plain, */*",
    "accept-language": "zh-CN,zh;q=0.9",
    "cache-control": "no-cache",
    "pragma": "no-cache",
    "priority": "u=1, i",
    "referer": "https://www.fnscore.cn/score.html",
    "sec-ch-ua": "\"Not;A=Brand\";v=\"99\", \"Google Chrome\";v=\"139\", \"Chromium\";v=\"139\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36",
    "x-requested-with": "XMLHttpRequest"
}
cookies = {
    "SHOW_ACTIVITY_PANEL": "false",
    "Hm_lvt_cadcf695428f7859d9d5e5d7bd270572": "1756449754,1756516791",
    "HMACCOUNT": "50AC8FFC6341318C",
    "Hm_lpvt_cadcf695428f7859d9d5e5d7bd270572": "1756518248"
}
url = "https://www.fnscore.cn/api/score/getListByDate"
params = {
    "gameType": "6",
    "date": "2025-08-31",
    "hot": "false",
    "onlyAnchor": "false",
    "token": "",
    "timestamp": now,
    # "sign": "PTkcS9mBDlfOzj0orFtztlSX9BfUFhwt2%2FJ%2BLt33mEE%3D"
}
n = f'timestamp={now}&secret=KHVheWluZ18zZWNyZXRfYXBB'
sign = js_compile.call("getSign", n)
params["sign"] = sign

# print(params)
# exit()

response = requests.get(url, headers=headers, cookies=cookies, params=params)

print(response.text)
